package org.ecpkn.PAGridSim.NodeScalingOptimization;

import java.util.ArrayList;

import org.ecpkn.PAGridSim.core.gridsimEntity.paMachine.PAMachine;
import org.ecpkn.PAGridSim.core.offlineOptimization.ChangingWorkloadOptimizationAlgo;
import org.ecpkn.PAGridSim.core.offlineOptimization.OptimizedResultEntry;
import org.ecpkn.PAGridSim.core.tasksCreation.Task;

public class NodeScalingChangingWorkloadOptimization extends
		ChangingWorkloadOptimizationAlgo {

	public NodeScalingChangingWorkloadOptimization(ArrayList<Task> tasks) {
		super(tasks);
	}

	@Override
	protected double singleTaskLoad(Task t) throws Exception {
		// 计算某个任务的单独负载
		double load = t.getUtilization(PAMachine.MAXRATING);
		return load;
	}

	@Override
	protected OptimizedResultEntry singleWorkloadOptimization(double workload)
			throws Exception {
		return new NodeScalingOptimization(workload).optimize();
	}
}
